#include "Tile.h"
#include "ResourceSystem.h"


Tile::Tile(const std::string& filename)
{
	image = ResourceSystem::GetImage(filename);
	this->filename = ResourceSystem::GetId(filename);
}

Tile::~Tile(void)
{
	ResourceSystem::FreeImage(filename);
}

void Tile::Draw(sf::RenderWindow* target)
{
	
}

void Tile::Update(int diff)
{
	//nothing yet?
}

void Tile::Load( const std::string& filename )
{
	
	if(image) {
		ResourceSystem::FreeImage(this->filename);
		image = ResourceSystem::GetImage(filename);
	} else {
		image = ResourceSystem::GetImage(filename);
	}
	this->filename = ResourceSystem::GetId(filename);
}